const user = require("../../database/user");

module.exports = async (req, res, next)=>{
  const {uId, tId, sex, age} = req.query;

  // 配置查询条件：根据接收到的字段，决定查询哪些数据
  const where = {};
  if(uId) where.uId = uId;
  if(tId) where.tId = tId;
  if(age) where.age = age;
  if(sex) where.sex = sex;

  const data = await user.find( where, {_id:0, __v:0});
  res.send({
    code: 1,
    msg:  "查询成功",
    data
  })
}